//
//  ObserveManager.swift
//  ObserveTiming
//
//  Created by JY_NEW on 2021/10/30.
//

import Foundation

/// 事件管理
public struct ObserveRouter<OBType> {
    let ob: OBType
    let timing: ObserveTiming
    
    // MARK: OC事件
    func observe<OCType: NSObject>(_ obj: OCType) -> OCObserveRouter<OCType, OBType> {
        return OCObserveRouter(obj: obj, ob: self.ob)
    }
    func unobserve<OCType: NSObject>(_ obj: OCType) -> OCUnobserveRouter<OCType, OBType> {
        return OCUnobserveRouter(obj: obj, ob: self.ob)
    }
    
    // MARK: Notification
    
    func observe(_ name: NSNotification.Name, action: @escaping (OBType, [AnyHashable: Any]?) -> Void) {
        
    }
    
    func observe(_ notificationName: String, action: @escaping (OBType, [AnyHashable: Any]?) -> Void) {
        self.observe(NSNotification.Name(rawValue: notificationName), action: action)
    }
    
    func unobserve(_ name: NSNotification.Name) {
        
    }
    
    func unobserve(_ notificationName: String) {
        self.unobserve(NSNotification.Name(rawValue: notificationName))
    }
    
    // MARK: 自定义事件
}
